<template>
	<view class="page page-fill">
		<view class="header">
			<!-- 未登录 -->
			<block v-if="!userIsLogined">
				<view>
					<image :src="userInfo.faceImage" class="face"></image>
				</view>
				<view>
					<navigator url="../registLogin/registLogin">
						<view class="nickname regist-login">
							注册/登录
						</view>
					</navigator>
				</view>
			</block>
			<!-- 已经登录 -->
			<block v-else>
				<view>
					<image :src="userInfo.faceImage" class="face"></image>
				</view>
				<view class="info-wapper">
					<view class="nickname">
						{{userInfo.nickname}}
					</view>
					<view class="nav-info">ID：{{userInfo.id}}</view>
				</view>
				<view class="set-wapper">
					<navigator url="../meInfo/meInfo">
						<image src="../../static/icos/settings.png" class="settings"></image>	
					</navigator>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userIsLogined:false,
				userInfo: {}
			}
		},
		onShow() {
			// 读取缓存数据
			let userInfo = uni.getStorageSync("globalUser");
			if(userInfo){
				// console.log(userInfo);
				this.userIsLogined  = true;
				this.userInfo = userInfo;
			}else{
				this.userIsLogined = false;
				this.userInfo = {};
			}
			
		},
		methods: {
			
		}
	}
</script>

<style lang="less">
	@import url("me.less");
</style>
